Chapter 6 Subnetting

What is a Network ID?
What is an Host ID?
What does a subnet mask do?
Which layer of TCP/IP Model "routes" the packet?


IP Addressing Fundamentals

An IP (Internet Protocol) address uniquely identifies a node or host connection to an IP network. System Administrators or network designers assign IP address to hosts (nodes). IP addresses are configured by software, not hardware specific. An IP address consist of two parts, Network address and Node (host) address.


Overview of TCP/IP Addresses

decimal=binary
192 = 11000000

128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0

TCP/IP Address Classes --First Octet

Class Start Binary Finish Binary Start Decimal Finish Decimal Networks Host per Network
A 00000001 011111111 1 127** 126 16,777,214
B 10000000 10111111 128 191 16,384 65,534
C 11000000 11011111 192 223 2,097,152 254

Note: the first byte of the first octet determines the class of the address.

**(127 reserved for loopback and internal testing on the local machine)

Class Start Binary Finish Binary
A 00000001 011111111
B 10000000 10111111
C 11000000 11011111

Class A networks start with 0
Class B networks start with 10
Class C networks start with 110

Default Subnet Mask

Class A = 255.0.0.0 (11111111.00000000.00000000.00000000)
Class B = 255.255.0.0 (11111111.11111111.00000000.00000000)
Class C = 255.255.255.0 (11111111.11111111.11111111.00000000)

Broadcast = 255.255.255.255 (11111111.11111111.11111111..11111111)


Math Section

220 219 218 217 216 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
1,048,576 524,288 262,144 131,072 65,536 32,768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1

 


Subnetting

Subnetting is an IP addressing scheme used for subnets. It enables you to take a single IP address from your ISP and make a group of networks out of it. You can then route between these networks internally and through your main router externally. It is a physical segment in a TCP/IP environment that uses IP addresses from a single network ID. The number of bits in the subnet mask will determine the number of subnets and hosts per subnets available to you.

IP layer uses the subnet mask to determine whether a host is on the local network or a remote network. To do this the bits of the subnet mask are turned on (255) for the portion that represents the network ID. The ANDing process pulls the first 16 bits from the IP address, which is the network ID. (an example is on page 95, figure 6.1) NOTE: there is a correction to the subnet mask in Table 6.1, it should be 255.255.0.0 rather than 255.255.255.0

What happens when a network is "subnetted" . You are simply set two or more extra bits to the "on" in the subnet mask. This way, IP layer sees more of the hosts with which you are communicating as being on a remote network (see Table 6.2)

Extra bits are used to identify the network

128 = 10000000 = 1 bit
192 = 11000000 = 2 bits
224 = 11100000 = 3 bits
240 = 11110000 = 4 bits
248 = 11111000 = 5 bits
252 = 11111100 = 6 bits
254 = 11111110 = 7 bits
255 = 11111111 = 8 bits

 

Quick Way to Determine a Number of Subnets and the number of Hosts per subnet.

Subnet = 2N-2
Host = 2
N

Class C example
Let's say you've got a subnet of 255.255.255.240
24 - 2 = 16 - 2 = 14 (240 Class C Subnet has 14 Networks)
24-2 = 16 - 2 = 14 (240 Class C Subnet has 14 host per subnet)

Class B example
Let's say you've got a subnet of 255.255.240.0
24 - 2 = 16 - 2 = 14 (240 Class B Subnet has 14 Networks)
212 - 2 = 4096 -2 = 4094 (240 Class C Subnet has 4096 host per subnet)

Class A example
Let's say you've got a subnet of 255.240.0.0
24 - 2 = 16 - 2 = 14 (240 Class A Subnet has 14 Networks)
220 - 2 = 1048576 -2 = 1048574 (240 Class A Subnet has 1048574 host per subnet)

Let's take at look at Table 6.3 on page 96.

IP Address 1st Octet 2nd Octet 3rd Octet 4th Octet
160.16.154.23 10100000 00010000 10011010 00010111
255.255.0.0 11111111 11111111 00000000 00000000
160.16.0.0 10100000 00010000 00000000 00000000
255.255.240.0 11111111 11111111 11110000 00000000
160.16.144.0 10100000 00010000 10010000 00000000

IP Address of 160.16.154.23 with the default subnet mask (255.255.0.0)= 160.16.0.0

IP Address of 160.16.154.23 with a 240 subnet mask = 160.16.144.0


Example 1

Is host 131.107.32.1 on the same subnet as 131.107.63.254 using a subnet mask of 255.255.224.0?

IP address 131.107.32.1 10000011.01100001.00100000.00000001
Subnet Mask 255.255.224.0 11111111.11111111.11100000.00000000
Network ID 131.107.32.0 10000011.01100001.00100000.00000000
     
IP address 131.107.63.254 10000011.01100001.00111111.11111110
Subnet Mask 255.255.224.0 11111111.11111111.11100000.00000000
Network ID 131.107.32.0 10000011.01100001.00100000.0000000

Answer is YES.

Let's look at the third octet of IP address and Subnet mask

Host 3rd Octet 32 00100000
Subnet 3rd Octet 224 11100000
Network ID 3rd Octet 32 00100000
     
Host 3rd Octet 63 00111111
Subnet 3rd Octet 224 11100000
Network ID 3rd Octet 32 00100000

If you compare the third octet of both addresses you'll see that the first IP address is on network 131.107.32.0 and the second IP address is also on network 131.107.32.0, these two host are local to one another.


Example 2

Is host 131.107.32.1 on the same subnet as 131.107.64.254 using a subnet mask of 255.255.224.0

IP address 131.107.32.1 10000011.01100001.00100000.00000001
Subnet Mask 255.255.224.0 11111111.11111111.11100000.00000000
Network ID 131.107.32.0 10000011.01100001.00100000.00000000
     
IP address 131.107.64.254 10000011.01100001.01000000.11111110
Subnet Mask 255.255.224.0 11111111.11111111.11100000.00000000
Network ID 131.107.64.0 10000011.01100001.01000000.0000000

Answer is NO, here's why

Let's look at the third octet of IP address and Subnet mask

Host 3rd Octet 32 00100000
Subnet 3rd Octet 224 11100000
Network ID 3rd Octet 32 00100000
     
Host 3rd Octet 64 01000000
Subnet 3rd Octet 224 11100000
Network ID 3rd Octet 64 01000000

If you compare the third octet of both addresses you'll see that the first IP address is on network 131.107.32.0 and the second IP address is on network 131.107.64.0. These two host are remote to one another, you will need a router

The first two octets of subnet mask are the same hence 160.16. Now lets look at the 3rd octet. With the first subnet mask (default one) the only bits that are turned on are the first 16 bytes (Network ID).